﻿package com.devilcat.ui {
	
	import flash.display.MovieClip;
	import com.devilcat.dt.Gamedt;
	import com.devilcat.ob.Itemob;	
	
	public class ItemListui extends MovieClip {
		public var canCatch:Boolean =true;
		
		public function ItemListui() {
			// constructor code
		}
		public function render(){
			if(Gamedt.Player.itemList.length<1) return;
			var item:Itemob;
			while (this.numChildren > 0) {
				this.removeChildAt(0);
			}
			trace("itemList "+Gamedt.Player.itemList.length);
			var countNumberOf:int=0;
			for (var i:int =0; i<Gamedt.Player.itemList.length; i++) {
				if(Gamedt.Player.itemList[i].NumberOf>0){
					item=new Itemob(Gamedt.Player.itemList[i]);
					item.y=24*countNumberOf;
					item.reText();
					item.addEventOutGame();
					this.addChild(item);
					countNumberOf++
				}
			}
			
		}
		public function renderBattle(){
			if(Gamedt.Player.itemList.length<1) return;
			var item:Itemob;
			while (this.numChildren > 0) {
				this.removeChildAt(0);
			}
			var countNumberOf:int=0;
			for (var i:int =0; i<Gamedt.Player.itemList.length; i++) {
				if(Gamedt.Player.itemList[i].NumberOf>0){
					item=new Itemob(Gamedt.Player.itemList[i]);
					item.y=24*countNumberOf;//235-
					item.reText();
					item.addEventInGame(canCatch);
					this.addChild(item);
					countNumberOf++
				}
			}
			
		}
	}
	
}
